
var app = getApp();

Page({
  data: {
    array: ['功能需求', '界面优化', '紧急漏洞', '客户服务','联系开发者', '其他'],
    index: 0,
    typeName: "功能需求",
    content:"",
    concat:null


  },
  bindPickerChange: function (e) {
    console.log('picker发送选择改变，携带值为', e.detail.value)
    this.setData({
      index: parseInt(e.detail.value),
      typeName: this.data.array[parseInt(e.detail.value)]
    })
  },
  onLoad: function (options) {
  },
  onReady: function () {

  },
  onShow: function () {

  },
  onHide: function () {
    // 页面隐藏

  },
  onUnload: function () {
    // 页面关闭
  },
  setInput(e){
    var val=e.detail.value;
    this.setData({"content":val})
    if(val.length>500){
      wx.showToast({
        title: '字数超过限制',
        icon:'none'
      })

    }
  },
  setConcat(e){
    var val=e.detail.value;
    this.setData({"concat":val})
  },
  submit(){
    let that = this
    var data={
      'concat':this.data.concat,
      "content":this.data.content,
      "typeName":this.data.typeName,
      "index": this.data.index,
      "user_id": app.globalData.user_id
    }
    wx.request({
      url: "http://" + app.globalData.url + "/user/feedback/",
      method: "POST",
      data: data,
      success: res => {
        wx.showToast({
          title: res.data.msg,
        })
      }
    })

  }
})